From dd715a77b3426792d2b09543590a0d59450c14bd Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 31 Jan 2012 14:39:57 +0000 Subject: [PATCH] libxl: use keyword arguments for field definitions in aggregate types. The original code is not so bad now that the comments are gone but this is still a bit cleaner. No change in the generated code. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl_types.idl | 2 +- tools/libxl/libxltypes.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 556f3fca3f..dbafa395e8 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -192,7 +192,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("bootloader_args", libxl_string_list), ("cmdline", string), ("ramdisk", libxl_file_reference), - ("features", string, True), + ("features", string, {'const': True}), # Use host's E820 for PCI passthrough. ("e820_host", bool), ])), diff --git a/tools/libxl/libxltypes.py b/tools/libxl/libxltypes.py index 338cfdeee9..880b7ca71d 100644 --- a/tools/libxl/libxltypes.py +++ b/tools/libxl/libxltypes.py @@ -154,17 +154,17 @@ class Aggregate(Type): self.fields = [] for f in fields: - # (name, type[, const=False]) + # (name, type[, {kw args}]) if len(f) == 2: n,t = f - const = False + kw = {} elif len(f) == 3: - n,t,const = f + n,t,kw = f else: raise ValueError if n is None: raise ValueError - self.fields.append(Field(t,n,const=const)) + self.fields.append(Field(t,n,**kw)) # Returns a tuple (stem, field-expr) # -- 2.30.2